package com.todaynews.utils.cipher;

import java.security.MessageDigest;

/**
 * @Description: SHA加密
 */
public class SHA {

    private final static SHA instance = new SHA();

    /**
     * 单例对象实例
     */
    public static SHA getInstance(){
        return instance;
    }

    public byte[] encrypt(byte[] data) throws Exception {
        MessageDigest sha = MessageDigest.getInstance(CipherType.SHA.getType());
        sha.update(data);
        return sha.digest();
    }
}
